{include file="admin_header.tpl"}

<link rel="stylesheet" href="../templates/he_admin_styles.css" title="stylesheet" type="text/css" />
{if $se_version<313}
<script type="text/javascript" src="../include/js/autosuggest.js"></script>
{/if}

{* for user suggestor *}
{literal}
<script type="text/javascript">
	window.addEvent('domready', function(){
		var options = {
			script:"admin_mass_message_tool.php?task=get_users&",
			varname:"username",
			json:true,
			shownoresults:false,
			multisuggest:false,
			timeout:5000
		};
		
		new bsn.AutoSuggest('setting_mass_message_from_user', options);
	});
</script>
{/literal}


<h2>{lang_print id=690690001}</h2>
{lang_print id=690690002} Please go to <a href="http://www.hire-experts.com/">Hire-Experts.com</a> to get this plugin latest version.<br />
<br />

{if $message}
	{if $message.info}
	  <div class='he_success'><img src='../images/success.gif' border='0' class='icon'> {$message.info}</div>
  {/if}
  {if $message.error}
	  <div class='he_error'><img src='../images/error.gif' border='0' class='icon'> {$message.error}</div>
	{/if}
{/if}

<br />

<div class="he_tabs">
	<a href="admin_mass_message_tool.php?tab=settings" class="{if $tab=='settings'}active{else}inactive{/if}">{lang_print id=690690003}</a>
	<a href="admin_mass_message_tool.php?tab=mass_message" class="{if $tab=='mass_message'}active{else}inactive{/if}">{lang_print id=690690004}</a>
	<a href="admin_mass_message_tool.php?tab=mass_email" class="{if $tab=='mass_email'}active{else}inactive{/if}">{lang_print id=690690005}</a>
</div>
<div class="he_body">

{if $tab=='settings'}
	<div class="he_tab_desc">{lang_print id=690690030}</div>
	<form action="admin_mass_message_tool.php" method="POST">
		<input type="hidden" name="tab" value="{$tab}" />
		<input type="hidden" name="task" value="save_settings" />
		<table class="he_tbl" width="460">
			<tbody>
				<tr class="bg1">
					<td>{lang_print id=690690006}</td>
					<td><input type="text" class="text" name="setting_mass_message_from_user" id="setting_mass_message_from_user" value="{$setting.setting_mass_message_from_user}" /></td>
				</tr>
				<tr class="bg1">
					<td>{lang_print id=690690007}</td>
					<td><input type="text" class="text" name="setting_mass_message_per_minute" value="{$setting.setting_mass_message_per_minute}" /></td>
				</tr>
				<tr class="bg1">
					<td>{lang_print id=690690008}</td>
					<td><input type="text" class="text" name="setting_mass_email_per_minute" value="{$setting.setting_mass_email_per_minute}" /></td>
				</tr>
			</tbody>
		</table><br />
		<div style="width:460px;" class="he_submit">
			<input type="submit" value="{lang_print id=690690009}" class="button" />
		</div>
	</form>
	
{elseif $tab=='mass_message'}

	<form action='admin_mass_message_tool.php' method="POST">
		<input type="hidden" name="tab" value="{$tab}" />
		<input type="hidden" name="task" value="mass_message" />
		
		<div class="he_item">
			<div class="he_label">{lang_print id=690690012}</div>
			<input type='text' name='subject' size='50' class='text' maxlength='200' />
		</div>
		
		<div class="he_item">
			<div class="he_label">{lang_print id=690690013}</div>
			<textarea name='message' class='text' rows='12' cols='100'></textarea><br />
			{lang_print id=690690016}
		</div>
		
		{* DETERMINE HOW MANY LEVELS AND SUBNETS TO SHOW BEFORE ADDING SCROLLBARS *}
		{if $levels|@count > 10 OR $subnets|@count+1 > 10}
		  {assign var='options_to_show' value='10'}
		{elseif $levels|@count > $subnets|@count+1}
		  {assign var='options_to_show' value=$levels|@count}
		{elseif $levels|@count < $subnets|@count+1}
		  {assign var='options_to_show' value=$subnets|@count+1}
		{elseif $levels|@count == $subnets|@count+1}
		  {assign var='options_to_show' value=$levels|@count}
		{/if}

		<div class="he_item">
			<div class="he_label">{lang_print id=690690014}</div>
			{lang_print id=690690015}<br /><br />
			
			<table cellpadding='0' cellspacing='0'>
				<tr>
					<td><b>{lang_print id=690690018}</b></td>
					<td style='padding-left: 10px;'><b>{lang_print id=690690019}</b></td>
				</tr>
				<tr>
					<td>
						<select size='{$options_to_show}' class='text' name='levels[]' id='levels' multiple='multiple' style='width: 270px;'>
						{section name=level_loop loop=$levels}
						<option value='{$levels[level_loop].level_id}' selected='selected'>{$levels[level_loop].level_name|truncate:75:"...":true}{if $levels[level_loop].level_default == 1} {lang_print id=690690021}{/if}</option>
						{/section}
						</select>
					</td>
					<td style='padding-left: 10px;'>
						<select size='{$options_to_show}' class='text' name='subnets[]' id='subnets' multiple='multiple' style='width: 270px;'>
						<option value='0' selected='selected'>{lang_print id=690690022}</option>
						{section name=subnet_loop loop=$subnets}
						<option value='{$subnets[subnet_loop].subnet_id}' selected='selected'>{lang_print id=$subnets[subnet_loop].subnet_name}</option>
						{/section}
						</select>
					</td>
				</tr>
				<tr>
					<td colspan="2"><br /><b>{lang_print id=690690020}</b></td>
				</tr>
				<tr>
					<td colspan="2">
						<select size='{if $cats|@count>10}10{else}{$cats|@count}{/if}' class='text' name='cats[]' id='cats' multiple='multiple' style='width: 270px;'>
						{foreach item='cat' from=$cats}
							<option value='{$cat.profilecat_id}' selected='selected'>{lang_print id=$cat.profilecat_title}</option>
						{/foreach}
						</select>
						
					</td>
				</tr>
			</table>
		</div>
		<br />
		<div class="he_submit">
			<input type='submit' class='button' value='{lang_print id=690690017}' />
		</div>
	</form>
	<br /><br /><br /><br />
	
	
	<h3><b>{lang_print id=690690025}</b></h3>
	<table class="he_tbl" width="100%">
		<thead>
			<td>{lang_print id=690690012}</td>
			<td>{lang_print id=690690026}</td>
			<td>{lang_print id=690690027}</td>
			<td>{lang_print id=690690028}</td>
		</thead>
		<tbody>
		{foreach from=$campaigns item='campaign'}
			<tr class="bg1">
				<td width="530" valign="top">
					<a href="javascript://" onclick="if( $('message_{$campaign.id}').style.display=='none' ) $('message_{$campaign.id}').style.display=''; else $('message_{$campaign.id}').style.display='none';">{$campaign.subject}</a>
					<div class="bg1" id="message_{$campaign.id}" style="display:none;"><br />{$campaign.message|nl2br}<br /><br /></div>
				</td>
				<td width="120" valign="top" align="center"><a href="../profile.php?user={$campaign.sender}">{$campaign.sender}</a></td>
				<td width="35" valign="top" align="center">{$campaign.recipient_count}</td>
				<td width="90" valign="top">{$datetime->cdate("F m, Y, g:i a", $datetime->timezone($campaign.sent_time, $setting.setting_timezone))}</td>
			</tr>
		{/foreach}
		</tbody>
	</table>
	<br />

{elseif $tab=='mass_email'}

	<br /><br />
	<div class="he_box" style="width:350px;">{lang_print id=690690024}</div>
	<br /><br />

{/if}

</div>

<br />
</div>